<template>
    <li class="choose-template" @click="imgevent">
        <img :src="i.imageUrl + '?x-oss-process=image/resize,w_800'"/>
        <p v-if="i.partnerName !== undefined"><span>{{keyindex + 1}}</span><span>{{i.partnerName}}</span></p>
    </li>
</template>
<script>
import api from '../api'
export default {
  props: ['i', 'keyindex'],
  methods: {
    imgevent () {
      var item = {}
      if (this.i.partnerId) {
        var params = {
          userId: this.$store.state.userID || '',
          partnerId: this.i.partnerId
        }
        api.creditloanDetail(params).then(res => {
          console.log(res)
          if (res.status === '200') {
            item = res.data
            var json = {
              partnername: this.i.partnerName,
              imagedesc: this.i.imageText,
              imgpartnerid: this.i.partnerId,
              addtaglineimg: this.i.imageUrl,
              imagename: this.i.imageName,
              logoUrl: this.i.logoUrl,
              qrCodeLogoIsShow: this.i.qrCodeLogoIsShow,
              imgid: this.i.id,
              judge: '0'
            } 
            localStorage.setItem('picture', JSON.stringify(json))
            window.location.href = '/picture/slogan'
          }
        })
      } else {
         var json = {
          partnername: this.i.partnerName,
          imagedesc: this.i.imageText,
          imgpartnerid: this.i.partnerId,
          addtaglineimg: this.i.imageUrl,
          imagename: this.i.imageName,
          imgid: this.i.id,
          judge: '0'
        }
        localStorage.setItem('picture', JSON.stringify(json))
        window.location.href = '/picture/slogan'
      }
    }
  }
}
</script>
